package study.io.springboot.upload.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import study.eggs.result.Result;
import study.eggs.result.Results;
import study.io.springboot.upload.service.AsyncCopyService;

@Slf4j
@RestController
@RequestMapping("/async_copy")
public class AsyncCopyController {

    @Autowired
    private AsyncCopyService asyncCopyService;

    @RequestMapping("/copy")
    public Result async_copy(@RequestBody Request request) {
        asyncCopyService.copy(request.getUrlLt(), request.getDest());
        return Results.ok();
    }
}
